// stores/tradeStore.js
import { defineStore } from 'pinia'

export const useTradeStore = defineStore('tradeStore', {
    state: () => ({
        positions: [],
        balances: {},
        tradeHistory: [],
        openTrades: []
    }),
    actions: {
        updatePositions(positions) {
            this.positions = positions;
        },
        updateBalances(balances) {
            this.balances = balances;
        },
        updateTradeHistory(tradeHistory) {
            this.tradeHistory = tradeHistory;
        },
        updateOpenTrades(openTrades) {
            this.openTrades = openTrades;
        },
        clearAllData() {
            this.positions = [];
            this.balances = {};
            this.tradeHistory = [];
            this.openTrades = [];
        }
    }
});
